package com.atguigu.lease.web.admin.service.impl;

import com.atguigu.lease.model.enums.BaseStatus;
import com.atguigu.lease.web.admin.vo.user.UserInfoQueryVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.lease.model.entity.UserInfo;
import com.atguigu.lease.web.admin.service.UserInfoService;
import com.atguigu.lease.web.admin.mapper.UserInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 10740
* @description 针对表【user_info(用户信息表)】的数据库操作Service实现
* @createDate 2024-06-18 18:20:58
*/
@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
    implements UserInfoService{
    @Autowired
    UserInfoMapper userInfoMapper;
    @Override
    public IPage<UserInfo> getUserByPage(IPage<UserInfo> userPage, UserInfoQueryVo queryVo) {
        String phone = queryVo.getPhone();
        BaseStatus status = queryVo.getStatus();
        LambdaQueryWrapper<UserInfo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(phone != null, UserInfo::getPhone, phone);
        queryWrapper.like(status != null, UserInfo::getStatus, status);
        IPage<UserInfo> userInfoIPage = userInfoMapper.selectPage(userPage, queryWrapper);

        return userInfoIPage;
    }
}




